﻿using System;
using System.Collections.Generic;
using System.Linq;
using InvestmentIntelligence.DbModel.Models;

namespace InvestmentIntelligence.Data.Repository
{
    public interface IAnalysisGroupRepository
    {
        /// <summary>
        ///     Add new group
        /// </summary>
        /// <param name="group"></param>
        /// <returns></returns>
        int Add(AnalysisGroup group);

        /// <summary>
        ///     Remove group By  ID
        /// </summary>
        /// <param name="groupId"></param>
        void Remove(int groupId);

        /// <summary>
        ///     Get List Of All groups
        /// </summary>
        /// <returns></returns>
        List<T> GetList<T>(Func<IQueryable<AnalysisGroup>, IEnumerable<T>> f);

        /// <summary>
        ///     Get List Of All groups with fundbooks
        /// </summary>
        /// <returns></returns>
        List<T> GetListWithFundbooks<T>(Func<IQueryable<AnalysisGroup>, IEnumerable<T>> f);


        /// <summary>
        ///     Return list of analysis group assigned to fundbook entity
        /// </summary>
        /// <param name="fundbookId"></param>
        /// <returns></returns>
        List<T> GetListByFundbook<T>(Func<IQueryable<AnalysisGroup>, IEnumerable<T>> f, int fundbookId);

        /// <summary>
        ///     Return list of Analysis groups with users
        /// </summary>
        /// <returns></returns>
        List<T> GetListWithUsers<T>(Func<IQueryable<AnalysisGroup>, IEnumerable<T>> f);

        /// <summary>
        ///     Get group by theirs ID
        /// </summary>
        /// <param name="groupId"></param>
        /// <returns></returns>
        AnalysisGroup Get(int groupId);

        /// <summary>
        ///     Update group
        /// </summary>
        /// <param name="group"></param>
        void Update(AnalysisGroup group);

        /// <summary>
        ///     Add existed user to existed analysis group
        /// </summary>
        /// <param name="groupId"></param>
        /// <param name="userId"></param>
        void AttachUserToGroup(int groupId, int userId);

        /// <summary>
        ///     Remove  user from analysis group
        /// </summary>
        /// <param name="groupId"></param>
        /// <param name="userId"></param>
        void RemoveUserFromGroup(int groupId, int userId);

        List<T> GetSharedUsers<T>(int userId, Func<IQueryable<User>, IEnumerable<T>> transform);
    }
}